﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FeedAntGame.Sprite.Event;

namespace FeedAntGame.Control
{
    class CandyPicker : BaseControl
    {
        Candy.TYPE type;
        /************************************************************************/
        /*                  GET/SET                                                                     */
        /************************************************************************/        

        internal Candy.TYPE Type
        {
            get { return type; }
            set
            { 
                type = value;
                createInstance(sprite.Position);
            }
        }
        
        /************************************************************************/
        /*                  Constructor                                                                     */
        /************************************************************************/

        public CandyPicker(Game game, Candy.TYPE type, Vector2 position)
            :base(game)
        {            
            this.type = type;
            createInstance(position);
        }

        protected override void createInstance(Vector2 position)
        {
            switch (type)
            {
                case Candy.TYPE.ORANGE:
                    sprite = new CandyPickerSprite(
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_normal"),
                        new Vector2(position.X, position.Y),
                        new Point(64, 68), 2, new Point(1, 1), Vector2.Zero, null, 1,
                        new Vector2(position.X, position.Y), type);
                    break;
                case Candy.TYPE.PEARL:
                    sprite = new CandyPickerSprite(
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_normal"),
                        new Vector2(position.X, position.Y),
                        new Point(64, 68), 2, new Point(1, 1), Vector2.Zero, null, 1,
                        new Vector2(position.X, position.Y), type);
                    break;
            }
                
        }
    }
}
